package tenth;

public class 泛型数组 {
    public static void main(String[] args) {
        Integer i[] = fun1(1, 2, 3, 4, 9);
        fun2(i);


        for (Integer integer : fun3(1, 2, 3, 5, 6, 7, 8, 3, 443, 22)) {
            System.out.print(integer + "\t");
        }
        String[] fun = fun4("占山", "李四", "王五", "兆能");
        System.out.println();
        for (String s : fun) {
            System.out.print(s + "\t");
        }
    }

    public static <T> T[] fun1(T... arg) {
        return arg;
    }

    public static <T> void fun2(T params[]) {
        System.out.print("接收泛型数组:");
        for (T t : params) {
            System.out.print(t + "、");
        }
        System.out.println();
    }

    public static <String> String[] fun3(String... strings) {
        return strings;
    }

    public static <Integer> Integer[] fun4(Integer... integers) {
        return integers;
    }
}
/*
D:\WorkSpaces\Java\jdk-21\bin\java.exe "-javaagent:D:\Software\IntelliJ IDEA\IntelliJ IDEA 2023.3.2\lib\idea_rt.jar=61198:D:\Software\IntelliJ IDEA\IntelliJ IDEA 2023.3.2\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath D:\WorkSpaces\JavaDevelopBase_start_329\out\production\JavaDevelopBase_start_329 tenth.泛型数组
接收泛型数组
1、2、3、4、9、

Process finished with exit code 0

 */